package com.mszlu.blog.service.impl;

import com.mszlu.blog.dao.mapper.ArticleMapper;
import com.mszlu.blog.dao.mapper.SysUserMapper;
import com.mszlu.blog.service.VisitornumService;
import com.mszlu.blog.vo.Result;
import com.mszlu.blog.vo.VisitornumVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Package: com.mszlu.blog.service.impl
 * @ClassName: VisitornumServiceImpl
 * @Author: 陈威
 * @CreateTime: 2021/9/24 15:44
 * @Description:
 */
@SuppressWarnings("all")
@Service
public class VisitornumServiceImpl implements VisitornumService {


    //获取总访问量及总用户量
    @Autowired
    ArticleMapper articleMapper;
    @Autowired
    SysUserMapper sysUserMapper;
    @Override
    public Result getReadAndCommentNum() {
        Long readNum = articleMapper.selectReadNum();
        Long userNum=sysUserMapper.selectUserNum();
        VisitornumVo vo = new VisitornumVo();
        vo.setPv(String.valueOf(readNum));
        vo.setUv(String.valueOf(userNum));
        return Result.success(vo);
    }
}